package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2022-12-06
 * Time: 20:59
 */
public class BookList {
    private static final int SIZE = 10;
    private final Book[] books = new Book[SIZE];
    private int useSize;//记录当前数组里有几本书
    // set and get
    public int getUseSize() {
        return useSize;
    }
    public void setUseSize(int useSize) {
        this.useSize = useSize;
    }
    public BookList() {
        books[0] = new Book("三国演义","罗贯中",89,"小说");
        books[1] = new Book("西游记","吴承恩",78,"小说");
        books[2] = new Book("红楼梦","曹雪芹",49,"小说");
        this.useSize = 3;
    }
    public Book getBook(int pos) {
        return this.books[pos];
    }

    public void setBook(Book book) {
        this.books[useSize] = book;
    }

    public void setBook(int pos,Book book) {
        this.books[pos] = book;
    }
}
